
#import <UIKit/UIKit.h>


typedef NS_ENUM(NSInteger, UIViewBorderLineType) {
    UIViewBorderLineTypeTop,
    UIViewBorderLineTypeRight,
    UIViewBorderLineTypeBottom,
    UIViewBorderLineTypeLeft,
};


@interface UIView (Extension)

@property(nonatomic)CGFloat cornerRad;
@property(nonatomic)CGFloat Cy;
@property(nonatomic)CGFloat Cx;

@property(nonatomic,assign)CGFloat X;
@property(nonatomic,assign)CGFloat Y;
@property(nonatomic,assign)CGFloat Sh;
@property (nonatomic,assign)CGSize ys_size;
@property(nonatomic,assign)CGFloat Sw;

-(void)setBlurStyle:(UIBlurEffectStyle)style;
-(void)removeBlur;

/// 生成图片
+ (UIImage *)snapshotWithView:(UIView *)view;
/// 生成图片
+ (UIImage *)snapshotWithScrollView:(UIScrollView *)scrollView;

#pragma mark - Create Table for button
+(UIView *)CreateTableWithFrame:(CGRect )frame Number:(int)Number spacing:(CGFloat)spacing;

#pragma mark - TapAction LongPressAction
- (void)setTapActionWithBlock:(void (^)(void))block;
- (void)setLongPressActionWithBlock:(void (^)(void))block;

/**
 *  添加圆角边框
 */
-(void)addBorderWithcornerRad:(CGFloat)cornerRad lineCollor:(UIColor *)collor lineWidth:(CGFloat)lineWidth;
/**
 *  加载
 */
-(void)startLoading;
-(void)stopLoding;

/**
 *  切某一方向的圆角
 */
-(void)viewCutRoundedOfRectCorner:(UIRectCorner)rectCorner cornerRadii:(CGFloat)cornerRadii;
/**
 *  获取view的所在控制器
 */
-(UIViewController*)MyViewController;



/**
 设置单边实线线条

 @param color 颜色
 @param border 边框宽度
 @param borderLineType 哪条边
 */
- (void)setViewBorderColor:(UIColor *)color border:(float)border type:(UIViewBorderLineType)borderLineType;


/**
 设置单边实线线条 包含两头缩进

 @param color 颜色
 @param border 边框宽度
 @param borderLineType 哪条边
 @param begin 距离头部
 @param end 距离尾部
 */
- (void)setViewBorderColor:(UIColor *)color border:(float)border type:(UIViewBorderLineType)borderLineType begin:(float)begin end:(float)end;



/**
 设置四条边虚线线条

 @param color 虚线颜色
 @param lineWidth 虚线宽度
 @param lineSpace 虚线间隔
 @param lineLength 虚线长度
 */
- (void)setViewBorderDottedLineColor:(UIColor *)color lineWidth:(float)lineWidth lineSpace:(float)lineSpace lineLength:(float)lineLength;


/**
 设置单边虚线线条

 @param color 虚线颜色
 @param lineWidth 虚线宽度
 @param lineSpace 虚线间隔
 @param lineLength 虚线长度
 @param borderLineType 设置view哪条边
 */
- (void)setViewBorderDottedLineColor:(UIColor *)color lineWidth:(float)lineWidth lineSpace:(float)lineSpace lineLength:(float)lineLength type:(UIViewBorderLineType)borderLineType;



/**
 设置单边虚线线条 包含两头缩进
 
 @param color 虚线颜色
 @param lineWidth 虚线宽度
 @param lineSpace 虚线间隔
 @param lineLength 虚线长度
 @param borderLineType 设置view哪条边
 @param begin 距离头部
 @param end 距离尾部
 */
- (void)setViewBorderDottedLineColor:(UIColor *)color lineWidth:(float)lineWidth lineSpace:(float)lineSpace lineLength:(float)lineLength type:(UIViewBorderLineType)borderLineType begin:(float)begin end:(float)end;



/**
 绘制线 在任意位置设置线 一般用于分割线

 @param color 线的颜色
 @param frame 线的坐标
 */
- (void)setViewBorderLine:(UIColor *)color frame:(CGRect)frame ;



/**
 设置带边框的圆角 layer

 @param color 边框颜色
 @param border 边框宽度
 @param radius 圆角弧度
 */
- (void)setViewBorderColor:(UIColor *)color border:(float)border radius:(float)radius;

/**
 设置四个角圆角弧度
 
 @param leftTop 左上角
 @param rigtTop 右上角
 @param bottemLeft 左下角
 @param bottemRight 右下角
 */
- (void)setViewCornerWithLeftTopCorner:(CGFloat)leftTop
                        rightTopCorner:(CGFloat)rigtTop
                      bottomLeftCorner:(CGFloat)bottemLeft
                     bottomRightCorner:(CGFloat)bottemRight;

#pragma mark - 删除 颜色渐变
/**
 删除 渐变颜色   当位置改变，layer 没有跟着改变时，需要移除，在重新添加
*/
- (void)removeColorGradation;



@end
